home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 119
/
(Vol 119) Nov 09 2010.iso
/
Games
/
tobby_ura_ura.swf
/
scripts
/
DefineSprite_54_tobby
/
frame_1
/
DoAction.as
Wrap
Text File
|
2010-11-09
|
3KB
|
163 lines
function main()
{
if(this.procNum == 1 && _root.gPlayFlg == true)
{
this.calc();
this.speedUp();
this.pAdd *= 1.01;
if(0.08 < this.pAdd)
{
this.pAdd = 0.08;
}
}
if(this.procNum == 2)
{
this.fall();
}
}
function speedUp()
{
if(_root.speedUpflg == true)
{
_root.scrollSpeed += 0.2;
if(8 < _root.scrollSpeed)
{
_root.scrollSpeed = 8;
}
}
else
{
_root.scrollSPeed -= 0.2;
if(_root.scrollSpeed < 1)
{
_root.scrollSpeed = 1;
}
}
}
function calc()
{
var dx = this.px - _parent.handMC._x;
var dy = this.py - _parent.handMC._y;
var r = Math.atan2(dy,dx);
this.pAngle = r / 0.017453292519943295 + 360;
this.pAngle = (this.pAngle + this.pSpeed) % 360;
_parent.stickMC.move(this.pAngle);
this.px = Math.cos(this.pAngle * 3.141592653589793 / 180) * this.pStickR + _parent.handMC._x;
this.py = Math.sin(this.pAngle * 3.141592653589793 / 180) * this.pStickR + _parent.handMC._y;
if(270 < this.pAngle)
{
if(0 >= this.pSpeed)
{
this.pSpeed = Math.abs(this.pAngle - 270) / 8;
}
this.pSpeed += this.pAdd;
}
if(this.pAngle < 270)
{
if(this.pSpeed >= 0)
{
this.pSpeed = (- Math.abs(this.pAngle - 270)) / 8;
}
this.pSpeed -= this.pAdd;
}
if(this.pAngle < 190 || 350 < this.pAngle)
{
this.pdy = this.py - this.old_py;
this.pdx = this.px - this.old_px;
if(this.pdx < -10)
{
this.pdx = -10;
}
if(10 < this.pdx)
{
this.pdx = 10;
}
if(this.pdy < -10)
{
this.pdy = -10;
}
this.pdr = 0;
this.procNum = 2;
var nRAngle = this.pAngle - this.old_Angle;
if(15 < nRAngle)
{
nRAngle = 15;
}
if(nRAngle < -15)
{
nRAngle = -15;
}
_parent.stickMC.entryFall(nRAngle);
_root.gPlayFlg = false;
}
if(625 < this.px || this.px < 5)
{
this.pdy = 0;
this.pdx = 0;
this.pdr = 0;
this.procNum = 2;
_parent.stickMC.entryFall(10);
_root.gPlayFlg = false;
}
this.old_py = this.py;
this.old_px = this.px;
this.old_Angle = this.pAngle;
}
function fall()
{
this.px += this.pdx;
this.py += this.pdy;
this.pr += this.pdr;
this.pdy += 1;
if(510 < this.py)
{
_root.gotoAndPlay("miss");
this.procNum = 0;
}
}
function miss()
{
if(this.missFlg == true)
{
return undefined;
}
this.SE_death.start();
this.pdy = -5;
this.pdx = 0;
this.pdr = 30;
this.procNum = 2;
_root.gPlayFlg = false;
this.missFlg = true;
}
function clear()
{
if(this.missFlg == true)
{
return false;
}
this.procNum = 0;
_root.gPlayFlg = false;
return true;
}
function clrMC()
{
this.removeMovieClip();
}
this.pSpeed = 0.01;
this.pAdd = 0.03;
this.px = 250;
this.py = 180;
this.pr = 0;
this.pdr = 0;
this.pAngle = 270;
this.pdx = 0;
this.pdy = 0;
this.old_px = this.px;
this.old_py = this.py;
this.old_angle = this.pAngle;
this.pStickR = 90;
this.procNum = 1;
this.missFlg = false;
this.SE_death = new Sound(this);
this.SE_death.attachSound("SE_death");